const _ = require("lodash");

function match(reg, str) {
  return str.match(reg);
}

let curryMatch = _.curry(match);
let haveSpace = curryMatch(/\s+/g);
let haveNumber = curryMatch(/\d+/g);
console.log(haveSpace("hello world"));
console.log(haveNumber("111"));

const filter = _.curry(function (func, array) {
  return array.filter(func);
});
let findSpace = filter(haveSpace);
console.log(filter(haveSpace, ["John Connor", "John_Donne"]));
console.log(findSpace(["John Connor", "John_Donne"]));
